//
//  LeftViewController.swift
//  likeQQ
//
//  Created by 邹佳林 on 16/7/25.
//  Copyright © 2016年 邹佳林. All rights reserved.
//

import UIKit

class LeftViewController: UIViewController,UITableViewDelegate,UITableViewDataSource
{

    @IBOutlet weak var avatarImageView: UIImageView!
    @IBOutlet weak var settingTabView: UITableView!
    @IBOutlet weak var heightLayoutConstraint: NSLayoutConstraint!
    
    let titlesDictionary = ["开通会员","QQ钱包","网上营业厅","个性装扮","我的收藏","我的相册","我的文件"]
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        settingTabView.delegate = self
        settingTabView.dataSource = self
        settingTabView.tableFooterView = UIView()
        
        heightLayoutConstraint.constant = Common.screeHeight < 500 ? Common.screeHeight * (568 - 211) / 568 : 347
        self.view.frame = CGRectMake(0, 0, 320 * 0.78, Common.screeHeight)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    //处理点击事件
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let viewController = Common.rootViewController
        viewController.homeViewController.titleOfOtherPages = titlesDictionary[indexPath.row]
        viewController.homeViewController.performSegueWithIdentifier("showOtherPages", sender: self)
        Common.contactsVC.view.removeFromSuperview()
        viewController.mainTabBarController.tabBar.hidden = true
        viewController.mainTabBarController.selectedIndex = 0
        viewController.showHome()
        tableView.deselectRowAtIndexPath(indexPath, animated: false)
        
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 7
    }
    
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        let cell = tableView.dequeueReusableCellWithIdentifier("leftViewCell",forIndexPath: indexPath)
        cell.backgroundColor = UIColor.clearColor()
        cell.textLabel!.text = titlesDictionary[indexPath.row]
        
        return cell
    }
    
    
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
